﻿using Dora.Tools.Enums.AdminUser;
using Dora.Tools.Utility;
using System;
using System.Collections.Generic;
using System.Text;

namespace Dora.Services.AdminUser.Dto.ViewDto
{
    /// <summary>
    /// 权限显示Dto
    /// </summary>
    public class PermissionListDto
    {

        #region model


        /// <summary>
        /// Id
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 父级Id
        /// </summary>
        public int ParentId { get; set; }

        /// <summary>
        /// 系统Id
        /// </summary>
        public int SystemId { get; set; }

        /// <summary>
        /// 系统Key
        /// </summary>
        public string SystemKey { get; set; }

        /// <summary>
        /// 级别序号
        /// </summary>
        public int LevelIdx { get; set; }

        /// <summary>
        /// 层级路径;从最祖宗到本级,英文逗号分隔,保留最后一个逗号
        /// </summary>
        public string LevelPath { get; set; }

        /// <summary>
        /// 权限名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 图标
        /// </summary>
        public string Icon { get; set; }

        /// <summary>
        /// 权限类型;1系统(在system_info表)2模块3菜单4按钮5数据
        /// </summary>
        public int PType { get; set; }

        /// <summary>
        /// 权限Key
        /// </summary>
        public string AuthKey { get; set; }

        /// <summary>
        /// 是否有下级
        /// </summary>
        public short HasSub { get; set; }

        /// <summary>
        /// 权限值;值和Type有关，1无或Url 4无或Url 5对应的权限值
        /// </summary>
        public string AuthValue { get; set; }

        /// <summary>
        /// 排序;倒序
        /// </summary>
        public int Sort { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 组织机构类型(用于分类TAS中不同机构权限)
        /// </summary>
        public int OrgType { get; set; }
        #endregion
        #region extend
        /// <summary>
        /// 权限列表
        /// </summary>
        public List<PermissionListDto> SubList { get; set; }

        /// <summary>
        /// 权限类型
        /// </summary>
        public string OrgTypeText
        {
            get
            {
                return ((PermissionOrgType)OrgType).ToDescription();
            }
        }
        /// <summary>
        /// 标识权限是否选中，选中表示用户有这个权限
        /// </summary>
        public bool IsSelected { get; set; }
        #endregion
    }
}
